package com.zbzly.reactive.reactiverbac.controller;

import io.jsonwebtoken.JwtException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import reactor.core.publisher.Mono;

@RestControllerAdvice
@Slf4j
public class ReactiveAdviceController {
    @ExceptionHandler(Exception.class)
    public Mono<String> handleException(Exception ex) {
        log.error(ex.getMessage(), ex);
        return Mono.just("error");
    }

    @ExceptionHandler(JwtException.class)
    public Mono<String> handlerJwtException(JwtException e) {
        log.error(e.getMessage(), e);
        return Mono.just("签名异常");
    }
}
